//
//  QXTextField.m
//  TicketPlan
//
//  Created by tangang on 2017/12/22.
//  Copyright © 2017年 tangang. All rights reserved.
//

#import "QXTextField.h"

@implementation QXTextField

- (void)drawRect:(CGRect)rect {
    // Drawing code
    [super drawRect:rect];
    [self addAccessoryView];
}

- (void)addAccessoryView{
    UIView *accessorView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 35*myY)];
    accessorView.backgroundColor = DEFAULTBGCOLOR;
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(real_size(315), 0, real_size(60), 35*myY)];
    [btn setTitle:@"完成" forState:UIControlStateNormal];
    [btn setTitleColor:DEFAULTTEXTCOLOR forState:UIControlStateNormal];
    [accessorView addSubview:btn];
    accessorView.userInteractionEnabled = YES;
    [btn addTarget:self action:@selector(doneClick) forControlEvents:UIControlEventTouchUpInside];
    self.inputAccessoryView = accessorView;
}

- (void)doneClick{
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
}
@end
